﻿
Ext.define('workflow.views.tasklist', {
                extend: 'Ext.grid.Panel',
                alias: 'widget.tasklist',

                requires: [
        'Ext.grid.plugin.CellEditing',
        'Ext.form.field.Text',
        'Ext.toolbar.TextItem'
    ],
                title:'任务列表',
                initComponent: function() {

                    this.editing = Ext.create('Ext.grid.plugin.CellEditing');

                    Ext.apply(this, {
                        iconCls: 'icon-grid',
                        frame: true,
                        plugins: [this.editing],
                        dockedItems: [{
                            xtype: 'toolbar',
                            items: [{
                                iconCls: 'icon-exec',
                                text: '执行',
                                disabled: true,
                                itemId: 'exec',
                                scope: this,
                                handler: this.onExecClick
                            }]
                            }],
                                        columns: [{
                                            text: 'id',
                                            width: 40,
                                            sortable: true,
                                            hidden:true,
                                            dataIndex: 'id'
                                        }, {
                                            header: '隐患简题',
                                            width: 100,
                                            sortable: true,
                                            dataIndex: 'yhjt',
                                            field: {
                                                type: 'textfield'
                                            }
                                        }, {
                                            header: '隐患来源',
                                            width: 100,
                                            sortable: true,
                                            dataIndex: 'yhly',
                                            field: {
                                                type: 'textfield'
                                            }
                                        }, {
                                            header: '隐患编号',
                                            flex: 1,
                                            sortable: true,
                                            dataIndex: 'yhbh',
                                            field: {
                                                type: 'textfield'
                                            }
                                        }, {
                                            header: '隐患单位',
                                            flex: 1,
                                            sortable: true,
                                            dataIndex: 'yhdw',
                                            field: {
                                                type: 'textfield'
                                            }
                                        }, {
                                            header: '专业分类',
                                            flex: 1,
                                            sortable: true,
                                            dataIndex: 'yhzyfl',
                                            field: {
                                                type: 'textfield'
                                            }
                                        }, {
                                            header: '发现人',
                                            flex: 1,
                                            sortable: true,
                                            dataIndex: 'yhfxr',
                                            field: {
                                                type: 'textfield'
                                            }
                                        }, {
                                            header: '发现日期',
                                            flex: 1,
                                            sortable: true,
                                            dataIndex: 'fxrq',
                                            renderer:Ext.util.Format.dateRenderer,
                                            field: {
                                                type: 'datefield'
                                            }
                                        },  {
                                            header: '流程状态',
                                            flex: 1,
                                            sortable: true,
                                            dataIndex: 'lcflag',
                                            field: {
                                                type: 'textfield'
                                            }
                                        },{
                                            header: '预评估负责人',
                                            flex: 1,
                                            sortable: true,
                                            dataIndex: 'ypgfzr',
                                            field: {
                                                type: 'textfield'
                                            }
                                        }, {
                                            header: '评估负责人',
                                            flex: 1,
                                            sortable: true,
                                            dataIndex: 'pgfzr',
                                            field: {
                                                type: 'textfield'
                                            }
                                        }, {
                                            header: '治理人',
                                            flex: 1,
                                            sortable: true,
                                            dataIndex: 'zlr',
                                            field: {
                                                type: 'textfield'
                                            }
                                        }, {
                                            header: '是否消除',
                                            flex: 1,
                                            sortable: true,
                                            dataIndex: 'yssfxc',
                                            field: {
                                                type: 'textfield'
                                            }
                                        }, {
                                            header: '验收组长',
                                            flex: 1,
                                            sortable: true,
                                            dataIndex: 'yszz',
                                            field: {
                                                type: 'textfield'
                                            }
                                        }, {
                                            header: '验收日期',
                                            flex: 1,
                                            sortable: true,
                                            dataIndex: 'ysrq',
                                            field: {
                                                type: 'textfield'
                                            }
                                        }]
                                        });
                                        this.callParent();
                                        //this.getSelectionModel().on('selectionchange', this.onSelectChange, this);
                                    },
                                    
                                    onExecClick: function() {
                                        var selection = this.getView().getSelectionModel().getSelection()[0];
                                        if (selection) {
                                            this.store.remove(selection);
                                        }
                                    }
                                });
                                
